package fm.dongman.modellib.source;

import android.support.annotation.NonNull;

import java.util.List;

import fm.dongman.animefm.contractlib.BaseDataSource;
import fm.dongman.animefm.contractlib.IModel;
import fm.dongman.animefm.contractlib.contract.RankInfoContract;
import fm.dongman.modellib.remote.RankInfoRemoteDataSource;

/**
 * @author alex on 2017/10/28.
 */

public class RankInfoRepository implements RankInfoContract.IRankInfoDataSource {
    private static RankInfoRepository INSTANCE;
    private RankInfoRemoteDataSource mRankInfoRemoteDataSource;

    public static RankInfoRepository getInstance(RankInfoRemoteDataSource dataSource) {
        if (INSTANCE == null) {
            INSTANCE = new RankInfoRepository(dataSource);
        }

        return INSTANCE;
    }

    private RankInfoRepository(RankInfoRemoteDataSource dataSource) {
        mRankInfoRemoteDataSource = dataSource;
    }

    @Override
    public void setRankInfo(int page, @NonNull String type) {
        mRankInfoRemoteDataSource.setRankInfo(page, type);
    }

    @Override
    public void getData(@NonNull final BaseDataSource.LoadSourceCallback<? super List<? extends IModel.IComicModel>> callback) {
        mRankInfoRemoteDataSource.getData(callback);
    }

    @Override
    public void saveData(List<? extends IModel.IComicModel> dataModel) {
    }

    @Override
    public void refreshData() {
    }

    @Override
    public void offLine() {
        mRankInfoRemoteDataSource.offLine();
    }
}
